import { delToken, getToken, setToken } from '@/utils/storage'

const user = {
  namespaced: true,
  state: {
    token: getToken()
  },
  mutations: {
    setToken (state, newToken) {
      setToken(newToken)
      state.token = newToken
    },
    delToken (state) {
      delToken()
      state.token = null
    }
  }
}
export default user
